<html class="hb-loaded">
 <head> 
  <meta content="text/html;charset=utf-8" http-equiv="Content-Type" /> 
  <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" /> 
  <meta content="yes" name="apple-mobile-web-app-capable" /> 
  <meta content="black" name="apple-mobile-web-app-status-bar-style" /> 
  <meta content="telephone=no" name="format-detection" /> 
  <meta content="email=no" name="format-detection" /> 
  <title>购物车 - 订单结算</title> 
 
  <script src="js/jquery.min.js"></script> 
  <script src="js/bootstrap.min.js"></script> 
  <link rel="stylesheet" href="css/bootstrap.min.css" /> 
  <link rel="stylesheet" href="css/public.v20150930.css" /> 
  <script src="js/ygop.ajax.client.js"></script> 
  <script src="js/Common.v150812.js"></script> 
  <script src="js/layer.m.js"></script> 
  <link rel="stylesheet" href="css/layer.css" /> 
  <script src="js/jweixin-1.0.0.js" type="text/javascript"></script> 
  <link rel="stylesheet" href="css/gps.css" /> 




 </head> 
 <body> 
  <link rel="stylesheet" href="css/order.css" /> 
  <div class="wrap"> 
   <div class="order jiesuan"> 
    <div class="add_address order-item" id="dvNewAddress" style="display: none;"> 
     <a href="addr_add.html?type=selectadd&amp;passKey=5aebb82bd99013f38d57daa170edf56a"> <em class="icon icon_add"> </em> <em class=" vm">新增收货地址</em><span class="arrow"></span> </a> 
    </div> 
    <div style="" class="order-item address" id="dvDeliveryAddress"> 
     <a href="/Cart/SelectAddress?consigneeId=9b14362c-fbc3-4e89-af16-4da77ab3469e"> 
      <div> 
       <span class="name"><span class="icon"></span><span id="address_name">黄金林</span></span> 
       <span class="tel"><span class="icon"></span><span id="address_mobile">18005151538</span></span> 
      </div> 
      <div id="address_detail">
       上海宝山区场景楼13号107
      </div> 
      <div class="arrow">
       &gt;
      </div> </a> 
    </div> 
    <div class="order-item"> 
     <div class="order-item-list"> 
      <a onclick="editDate()"> <span>配送日期</span> <span class="fright font-color000" id="order_deliverydate">2015-10-26</span> 
       <div class="arrow">
        &gt;
       </div> </a> 
     </div> 
     <div class="order-item-list"> 
      <a href="/Cart/SelectPayment"> <span>支付方式</span> <span class="fright font-color000" id="order_payment">支付宝网页支付</span> 
       <div class="arrow">
        &gt;
       </div> </a> 
     </div> 
    </div> 
    <div class="order-item"> 
     <div class="order-item-list"> 
      <a id="order_invoice_link"> <span>发票信息</span> <span class="fright font-color000" id="order_invoice">不需要</span> 
       <div class="arrow">
        &gt;
       </div> </a> 
     </div> 
     <div class="order-item-list"> 
      <a class="youhuitip" href="/Cart/SelectCoupons" id="order_item_couon"> <span class="tittle">优惠代码</span> <span class="fright" id="order_coupon_default" style="display: none;">请选择使用你的优惠代码</span> <span class="words" id="order_coupon_text" style="display: none;"></span> <span class="fright circlebg" id="order_coupon_count">9</span> 
       <div class="arrow">
        &gt;
       </div> </a> 
     </div> 
    </div> 
    <div class="order-item"> 
     <div class="order-item-list"> 
      <input type="text" placeholder="若您对订单有特殊要求，请填写备注" id="order_webremark" /> 
     </div> 
    </div> 
    <div onclick="showCartList()" class="order-item goods-all clearfix"> 
     <ul id="order_item_pics">
      <li><img width="50" height="50" src="images/441634252785164106.jpg" /></li>
      <li><img width="50" height="50" src="images/441634252490579786.jpg" /></li>
     </ul> 
    </div> 
    <div style="display:none" class="order-item goods-all clearfix"> 
     <ul id="order_item_single"></ul> 
    </div> 
    <div class="order-item"> 
     <ul class="price_ul"> 
      <li> <span class="gray">商品金额</span><span class="fright font-color000" id="order_totalprice">￥124.00</span></li> 
      <li> <span class="gray">运费</span><span class="fright font-color000" id="order_freight">￥0.00</span></li> 
      <li> <span class="gray">折扣</span><span class="fright green" id="order_discountamount">-￥0.00</span></li> 
     </ul> 
    </div> 
    <div class="payment_total"> 
     <div class="shp_cart_info"> 
      <span class="shp_cart_total">应付金额:<strong id="order_paymentamount">￥124.00</strong></span> 
     </div> 
     <a class="btn_right" id="order_submit">提交订单(<span id="order_cart_num">2</span>)</a> 
    </div> 
   </div> 
  </div> 
  <div aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="delivery-date" class="modal"> 
   <div role="document" class="modal-dialog"> 
    <div class="modal-content"> 
     <button aria-label="Close" data-dismiss="modal" class="close" type="button"><span aria-hidden="true">&times;</span></button> 
     <div class="delivery-date"> 
      <div class="tips" id="delivery_date_tips"></div> 
      <dl class="date" id="dlChoseDeliveryDate">
       <dt>
        请选择收货日期
       </dt>
       <dd class="active">
        <a value="2015-10-26" onclick="chooseDeliveryDate(this)" href="javascript:void(0)">2015-10-26</a>
       </dd>
       <dd>
        <a value="2015-10-27" onclick="chooseDeliveryDate(this)" href="javascript:void(0)">2015-10-27</a>
       </dd>
       <dd>
        <a value="2015-10-28" onclick="chooseDeliveryDate(this)" href="javascript:void(0)">2015-10-28</a>
       </dd>
       <dd>
        <a value="2015-10-29" onclick="chooseDeliveryDate(this)" href="javascript:void(0)">2015-10-29</a>
       </dd>
       <dd>
        <a value="2015-10-30" onclick="chooseDeliveryDate(this)" href="javascript:void(0)">2015-10-30</a>
       </dd>
       <dd>
        <a value="2015-10-31" onclick="chooseDeliveryDate(this)" href="javascript:void(0)">2015-10-31</a>
       </dd>
       <dd>
        <a value="2015-11-01" onclick="chooseDeliveryDate(this)" href="javascript:void(0)">2015-11-01</a>
       </dd>
       <dd>
        <a value="2015-11-02" onclick="chooseDeliveryDate(this)" href="javascript:void(0)">2015-11-02</a>
       </dd>
       <dd>
        <a value="2015-11-03" onclick="chooseDeliveryDate(this)" href="javascript:void(0)">2015-11-03</a>
       </dd>
      </dl> 
     </div> 
    </div> 
   </div> 
  </div> 
  <div aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="invoice" class="modal"> 
   <div role="document" class="modal-dialog"> 
    <div class="modal-content"> 
     <button aria-label="Close" data-dismiss="modal" class="close" type="button"><span aria-hidden="true">&times;</span></button> 
     <div class="invoice"> 
      <dl> 
       <dt>
        发票类型
       </dt> 
       <dd id="invoice_type"> 
        <span> <input type="radio" value="0" name="type" id="invoice_type_person" /> <label for="invoice_type_person">个人发票</label> </span> 
        <span> <input type="radio" value="1" name="type" id="invoice_type_company" /> <label for="invoice_type_company">单位发票</label> </span> 
       </dd> 
      </dl> 
      <dl> 
       <dt>
        发票抬头
       </dt> 
       <dd>
        <input type="text" placeholder="单位抬头请填写单位名称" class="input-text" id="invoice_title" />
       </dd> 
      </dl> 
      <dl> 
       <dt>
        发票内容
       </dt> 
       <dd id="invoice_content"> 
        <span> <input type="radio" value="水果" name="content" id="invoice_content_fruit" /> <label for="invoice_content_fruit">水果</label> </span> 
        <span> <input type="radio" value="食品" name="content" id="invoice_content_food" /> <label for="invoice_content_food">食品</label> </span> 
       </dd> 
      </dl> 
      <div class="btn-submit clearfix"> 
       <span><button onclick="ChooseInvoice(true)" type="button">确定</button></span> 
       <span><button onclick="ChooseInvoice(false)" type="button">不需要</button></span> 
      </div> 
      <div class="tip">
       请注意：发票金额只开非预存款支付部分
      </div> 
     </div> 
    </div> 
   </div> 
  </div> 
  <div aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="cart_list" class="modal"> 
   <div role="document" class="modal-dialog"> 
    <div class="modal-content"> 
     <button aria-label="Close" data-dismiss="modal" class="close" type="button"><span aria-hidden="true">&times;</span></button> 
     <div class="cart_list" id="cart_list_details">
      <li class="cart_list_li">
       <div class="product-item">
        <div class="product_thumb">
         <a href="javascript:void(0)"><img width="85" height="85" src="images/441634252785164106.jpg" /></a>
        </div>
        <div class="product_info">
         <div class="product_name">
          阿拉斯加格陵兰大比目鱼(切段)
         </div>
         <div class="product_price">
          ￥66.00
          <span>(null)</span>
         </div>
         <div class="quantity">
          &times; 1
         </div>
        </div>
       </div></li>
      <li class="cart_list_li">
       <div class="product-item">
        <div class="product_thumb">
         <a href="javascript:void(0)"><img width="85" height="85" src="images/441634252490579786.jpg" /></a>
        </div>
        <div class="product_info">
         <div class="product_name">
          美国加州(整条）鱿鱼1kg
         </div>
         <div class="product_price">
          ￥58.00
          <span>(null)</span>
         </div>
         <div class="quantity">
          &times; 1
         </div>
        </div>
       </div></li>
     </div> 
    </div> 
   </div> 
  </div> 
  <script type="text/javascript">
    $(document).ready(function () {
        refreshSettle();

        $("#order_submit").click(function () {
            var remark = $("#order_webremark").val().trim();
            if (remark.length > 50) {
                YgmJsCommon.popups.alert("备注信息长度不能超过50！");
                return;
            }
            YgmJsCommon.popups.loading();
            var adTrack = YgmDplus.getAdTrack();
            ygopAjaxClient.async("/SettleOpt/CreateOrder", "post", { remark: remark, adTrack: JSON.stringify(adTrack) }, function (e) {
                YgmJsCommon.popups.close();
                if (e.RspCode == 1) {

                    // 提交订单
                    dplus.track("提交订单");

                    YgmJsCommon.clearCartProducts();
                    location.href = "/Cart/Complete/" + e.RspData.OrderId;
                }
                else {
                    YgmJsCommon.popups.alert(e.RspMsg);
                }
            });
        });

        $("#order_invoice_link").click(function () {
            //弹出选择发票
            $("#invoice").modal('show');
        });
    });

    function refreshSettle() {
//        YgmJsCommon.popups.loading();
       
    }

    function chooseDeliveryDate(sender) {
        var link = $(sender);
        var data = link.attr("value");
        YgmJsCommon.popups.loading();
        ygopAjaxClient.async("/SettleOpt/ChooseDeliveryDate", "post", { date: data }, function (e) {
            YgmJsCommon.popups.close();
            if (e.RspCode == 1) {
                location.reload();
            }
            else {
                YgmJsCommon.popups.alert(e.RspMsg);
            }
        });
    }

    function ChooseInvoice(isinvoice) {
        if (!isinvoice) {
            YgmJsCommon.popups.loading();
            ygopAjaxClient.async("/SettleOpt/WithoutInvoice", "post", null, function (e) {
                YgmJsCommon.popups.close();
                if (e.RspCode == 1) {
                    location.reload();
                }
                else {
                    YgmJsCommon.popups.alert(e.RspMsg);
                }
            });
            return;
        }

        var kind = $("#invoice_type :radio:checked");
        if (kind.length != 1) {
            YgmJsCommon.popups.alert("请选择发票类型");
            return;
        }
        if ($("#invoice_title").val().trim() == "") {
            YgmJsCommon.popups.alert("请填写发票抬头");
            return;
        }
        var content = $("#invoice_content :radio:checked");
        if (content.length != 1) {
            YgmJsCommon.popups.alert("请选择发票内容");
            return;
        }
        var invoice = {};
        invoice.InvoiceKind = kind.val();
        invoice.InvoiceTitle = $("#invoice_title").val().trim();
        invoice.InvoiceContent = content.val();


        YgmJsCommon.popups.loading();
        ygopAjaxClient.async("/SettleOpt/ChooseInvoice", "post", invoice, function (e) {
            YgmJsCommon.popups.close();
            if (e.RspCode == 1) {
                location.reload();
            }
            else {
                YgmJsCommon.popups.alert(e.RspMsg);
            }
        });
    }

    //弹出选择发票
    function editInvoice() {
        $("#invoice").modal('show');
    }

    //弹出选择配送日期
    function editDate() {
        $("#delivery-date").modal('show');
    }

    //弹出已购商品详情
    function showCartList() {
        $("#cart_list").modal('show');
    }

    //弹出框居中
    $('#invoice,#delivery-date,#cart_list').on('shown.bs.modal', function () {
        var win_width = $(this).find(".modal-dialog").width();
        var win_height = $(this).find(".modal-dialog").height();
        $(this).find(".modal-dialog").css({ "marginTop": String(-1 * win_height / 2) + "px", "marginLeft": String(-1 * win_width / 2) + "px" });

    });
</script> 
  <footer class="footer"> 
   <a class="current" href="index.html" id="index"><span class="home">首页</span>首页</a> 
   <a href="cat.html" id="category"><span class="catalog">分类</span>分类</a> 
   <a href="cart.html" id="cart"> <span class="shopping">购物车<font id="fCartProductTotalCount" class="badge">2</font></span>购物车 </a> 
   <a href="member_index.html" id="my"><span class="my">我的易果</span>我的易果</a> 
  </footer> 
  <div data-backdrop="static" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="divMyCity" class="modal" style="display: none;"> 
   <div role="document" class="modal-dialog"> 
    <div id="divCityContent" class="modal-content"> 
     <div style=" display:block;" class="gpstips"> 
      <a> <em class=" icon icon_gps"> </em> 亲，请先选择您的收货城市 <em class=" icon icon_arrowright"> </em> </a> 
     </div> 
    </div> 
   </div> 
  </div> 
  <script type="text/javascript">
        var _wx_JsConfig = {};
        _wx_JsConfig.appid = "wx0d4f4f0e0bada80e";
        _wx_JsConfig.imgUrl = "http://img02.yiguo.com/e/web/150930/00783/155744/wxlogo.jpg";
        _wx_JsConfig.title = "易果生鲜触屏版";
        _wx_JsConfig.content = "全国首家生鲜专业电商，全球优质生鲜产地直供，全年无休生鲜冷链配送";
        _wx_JsConfig.timeLineLink = "http://weixin.m.yiguo.com";

        _wx_JsConfig.timestamp = "";
        _wx_JsConfig.nonceStr = "";
        _wx_JsConfig.signature = "";

        $(function () {
            YgmJsCommon.domain = "yiguo.com";
            var jsonWxCfg = decodeURIComponent("%7b%22appId%22%3anull%2c%22timestamp%22%3a%221445765608%22%2c%22nonceStr%22%3a%221309023920%22%2c%22signature%22%3a%2292b33e0057ea16e0e13249c7222e9bd26cdc0b14%22%2c%22url%22%3a%22http%3a%2f%2fweixin.m.yiguo.com%2fsettle%22%2c%22jsapi_ticket%22%3a%22bxLdikRXVbTPdHSM05e5u_n3yqdZ_9Pt0dvnbtzvrXZ2Bps91PjRajJdScVYkXWafhoi6zfSwxWok0rXn11cmQ%22%7d");
            var wxJsCfg = JSON.parse(jsonWxCfg);
            _wx_JsConfig.timestamp = wxJsCfg.timestamp;
            _wx_JsConfig.nonceStr = wxJsCfg.nonceStr;
            _wx_JsConfig.signature = wxJsCfg.signature;

            wx.config({
                //debug: true,
                appId: _wx_JsConfig.appid,
                timestamp: _wx_JsConfig.timestamp,
                nonceStr: _wx_JsConfig.nonceStr,
                signature: _wx_JsConfig.signature,
                jsApiList: [
                    'onMenuShareTimeline',
                    'onMenuShareAppMessage'
                ]
            });

            myShare();

            getCartCount();

            showSelectedCityDialog();
        })

        function myShare() {
            wx.ready(function () {
                //分享朋友圈
                wx.onMenuShareTimeline({
                    title: _wx_JsConfig.title,
                    desc: _wx_JsConfig.content, // 分享描述
                    link: _wx_JsConfig.timeLineLink,
                    imgUrl: _wx_JsConfig.imgUrl,
                    trigger: function (res) {
                    },
                    success: function (res) {
                        dplus.track("分享到朋友圈");
                    },
                    cancel: function (res) {
                    },
                    fail: function (res) {
                    }
                });
                //分享朋友
                wx.onMenuShareAppMessage({
                    title: _wx_JsConfig.title,
                    desc: _wx_JsConfig.content,
                    link: _wx_JsConfig.timeLineLink,
                    imgUrl: _wx_JsConfig.imgUrl,
                    trigger: function (res) {
                    },
                    success: function (res) {
                        dplus.track("分享给朋友");
                    },
                    cancel: function (res) {
                    },
                    fail: function (res) {
                    }
                });
            });

        }

        //如果查询到CityCookie default=1，表示用户没有选择过城市，则需要弹出选择城市
        function showSelectedCityDialog() {
            var objCity = YgmJsCommon.getCityCookie();
            if (objCity != null && objCity.Default == 1) {
                $("#divMyCity").css('display', "");
                $("#divMyCity").modal('show');
                $("#divMyCity").click(function () {
                    window.location.href = "/Home/SelectCity";
                })
            }
            else {
                $("#divMyCity").css('display', "none");
            }
        }

        //返回商品数量显示在footer上
        function getCartCount() {
            var count = YgmJsCommon.getCartProductsTotalCount();
            if (count > 0) {
                $("#fCartProductTotalCount").css("display", "");
                $("#fCartProductTotalCount").html(count);
            }
            else {
                $("#fCartProductTotalCount").css("display", "none");
            }
            return count;
        }

        //设置云朵的位置
        $('#divMyCity').on('shown.bs.modal', function () {
            var win_width = $(this).find(".modal-dialog").width();
            var win_height = $(this).find(".modal-dialog").height();
            $(this).find(".modal-dialog").css({ "marginTop": String(-1 * win_height / 2) + "px", "marginLeft": String(-1 * win_width / 2) + "px" });

        });

        window.onload = function () {
            
        };
    </script> 
 </body>
</html>